/**
 * <p>Title: DoubleDetectionSingleton.java>
 * <p>Description: 单例模式-双重检测
 * <p>Company: YSS
 * @author yangsongsong
 * @date 2018年12月31日
 */
package com.yss.singleton;

public class DoubleDetectionSingleton {
	private static volatile DoubleDetectionSingleton sInst = null;

	private DoubleDetectionSingleton() {
	}

	public static DoubleDetectionSingleton getInstance() {
		DoubleDetectionSingleton dInst = sInst;
		if (dInst == null) {
			synchronized (DoubleDetectionSingleton.class) {
				dInst = sInst;
				if (dInst == null) {
					dInst = new DoubleDetectionSingleton();
					sInst = dInst;
				}
			}
		}
		return dInst;
	}

	protected void method() {
		System.out.println("DoubleDetectionSingleton");
	}
}
